package net.qhzw.geologr5.gis.service.system.controller;


import net.qhzw.geologr5.gis.common.framework.utils.JsonResult;
import net.qhzw.geologr5.gis.service.system.query.ProjectMapQuery;
import net.qhzw.geologr5.gis.service.system.service.ProjectMapServer;
import net.qhzw.geologr5.gis.service.system.service.ProjectTypeService;
import net.qhzw.geologr5.gis.service.system.vo.project.ProjectMapVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/***
 * 项目地图前端控制器
 */

@RestController
@RequestMapping("projectMap")
public class ProjectMapController {


    @Autowired
    private ProjectMapServer projectMapServer;

    @Autowired
    private ProjectTypeService projectTypeService;


    /***
     * 添加项目地图
     * @return
     */
    @PostMapping("create")
    public JsonResult create(@RequestBody ProjectMapVo projectMap) {
        return projectMapServer.create(projectMap);
    }


    /***
     *  查询项目地图
     * @return
     */
    @GetMapping("find")
    public JsonResult find(ProjectMapQuery query) {
        return projectMapServer.find(query);
    }


    /***
     * 删除项目地图
     * @param ids
     * @return
     */
    @DeleteMapping("delete/{ids}")
    public JsonResult delete(@PathVariable Integer[] ids) {
        return projectMapServer.delete(ids);
    }


    /***
     * ARSGist上传
     * @return
     */
    @PostMapping("uploadARSGist")
    public JsonResult uploadARSGist(@RequestParam Integer id, @RequestParam MultipartFile file, @RequestParam MultipartFile coordinateFile) {
        return projectMapServer.uploadARSGist(id, file, coordinateFile);
    }

    /***
     * 图例配置
     * @param query
     * @return
     */
    @PostMapping("uploadLegend")
    public JsonResult uploadLegend(@RequestBody ProjectMapQuery query) {
        return projectMapServer.uploadLegend(query);
    }


    /**
     * 地图查看
     *
     * @return
     */
    @GetMapping("showMap")
    public JsonResult showMap(ProjectMapQuery query) {
        return projectMapServer.showMap(query);
    }


    /****
     * 图例查看
     * @param query
     * @return
     */
    @GetMapping("showLegend")
    public JsonResult showLegend(ProjectMapQuery query) {
        return projectMapServer.showLegend(query);
    }

    /***
     * 复制项目地图
     * @param id
     * @return
     */
    @GetMapping("copy/{id}")
    public JsonResult copy(@PathVariable("id") Integer id) {
        return projectMapServer.copy(id);
    }


    /****
     * 上传坐标系文件
     * @param id
     * @return
     */
    @PostMapping("uploadCoordinatesFile")
    public JsonResult uploadCoordinatesFile(@RequestParam Integer id, @RequestParam MultipartFile file) {
        return projectMapServer.uploadCoordinatesFile(id, file);
    }


}
